home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #279 (1993)(Rhein-Sieg-Soft).zip
/
Franz PD Disk #279 (1993)(Rhein-Sieg-Soft).adf
/
ak_gen0-lib_V38.20.LHA
/
ak_gen0-library
/
Programmers.LHA
/
Programmers
/
Examples
/
OldReadDir.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-11
|
2KB
|
54 lines
/* OldReadDir V38.1 */
/* FREEWARE. */
/* (c) 1993 by Andreas R. Kleinert. */
/* Demonstrates use of the "AK_ReadDir()" function. */
/* This function is actually OBSOLETE and you should */
/* use "AK_GetDirList()" instead, if possible. */
/* Written in SAS/C V6.00 for OS V2.04 (V37) Includes. */
#include <ak_gen0/ak_gen0_pragma.h>
#include <stdlib.h>
#include <proto/exec.h>
#include <proto/intuition.h>
void main(long argc, char **argv) /* MAIN */
{
printf("\nOldReadDir V38.1, FREEWARE, (c) 1993 by Andreas R. Kleinert.\n");
AKBase = (struct AKBase *) OpenLibrary("ak_gen0.library", 37); /* minimum */
if(AKBase)
{
char *direntry[AK_MAX_READDIR_ENTRIES];
long dirtype [AK_MAX_READDIR_ENTRIES], count, i;
for(i=0; i<AK_MAX_READDIR_ENTRIES; i++) direntry[i] = (APTR) AllocMem(AK_MAX_DOS_FILENAME_LEN, MEMF_CLEAR);
if(direntry[i-1]) /* enough memory for all entries (test last one) ? */
{
if(argv[1]) count = AK_ReadDir(argv[1], &direntry[0], &dirtype[0]);
else count = AK_ReadDir( "", &direntry[0], &dirtype[0]);
for(i=0; i<=count; i++)
{
printf("\n %ld : %s", i, direntry[i]);
if(dirtype[i] == AKF_IS_DIR) printf(" (DIR)");
}
printf("\n\n");
}
for(i=0; i<AK_MAX_READDIR_ENTRIES; i++) if(direntry[i]) FreeMem(direntry[i], AK_MAX_DOS_FILENAME_LEN);
CloseLibrary((APTR) AKBase);
}else
{
printf("\n Can't open \42ak_gen0.library\42 V37+ !\n");
}
exit(0);
}